PID, or proportional - integral - differential control is the most common control algorithim in engineering. Control Theory is a major branch of engineering. Of course, PID also has a Wiki entry.
A great explanation of PID theory for the purposes of this lab is from National Instruments.
An excellent article on Control Theory is Feedback for Physicists, by John Bechhoefer. Either read his 2005 Reviews of Modern Physics article, or purchase his 2021 book on Control Theory and read it. You should buy the book - I did.
The PID section is modeled by
with u the % of the PWM, or the power flowing into the TEC. The system - F(x) - represents the TEC response itself and is described by
If you want to see how engineers approach feedback and control, read chapter 10 of Astrom and Murray on PID theory. They have a website for the book. This is pretty advanced stuff.
Implement the anti-windup circuit, but not the differential filter (which I found unecessary). Anti-windup is a good thing, which you can discovery by leaving it out.
I found error feedback worked better than Setpoint Weighting.